﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Project.Models
{
    /// <summary>
    /// 订单明细
    /// </summary>
    public class OrderDetail:BaseModel
    {

        public OrderDetail()
        {
            Toothes = new List<ToothPosition>();
          //  PriceTemplate = new PriceTemplate();
           // Files = new List<OrderFiles>();
        }

        /// <summary>
        /// 订单编号（外键）
        /// </summary>
        public Guid OrderId { get; set; }

        [ForeignKey(nameof(OrderId))]
        public Order Order { get; set; }

        /// <summary>
        /// 外部单号
        /// </summary>
        [StringLength(20)]
        public string OuterNo { get; set; } = "";

        /// <summary>
        /// 要求设计工具名称
        /// </summary>
        [StringLength(20)]
        public string   DesignTool { get; set; }

        /// <summary>
        /// 价格模板Id
        /// </summary>
        public Guid? PriceTemplateId { get; set; }

        [ForeignKey(nameof(PriceTemplateId))]
        public virtual PriceTemplate PriceTemplate { get; set; }

        // 牙位集合
        public List<ToothPosition> Toothes { get; set; }

        public decimal Price { get; set; }

        /// <summary>
        /// 上传数据类型
        /// </summary>
        [StringLength(20)]
        [Required]
        public string DataType { get; set; }

        /// <summary>
        /// 上传的文件(附件)地址
        /// </summary>
        public virtual List<OrderFiles> Files { get; set; }

        /// <summary>
        /// 设计需求
        /// </summary>
        [StringLength(500)]
        public string Requirement { get; set; }

        /// <summary>
        /// 设计需求文件地址
        /// </summary>
        [StringLength(300)]
        public string RequirementFile { get; set; }
    }
}
